﻿using System;

namespace Aeon.Emulator.Instructions
{
    /// <summary>
    /// Marks an alternative method to use for emulating an opcode when
    /// the operand size or address size is not 16 bits.
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    internal sealed class AlternateAttribute : Attribute
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the AlternateAttribute class.
        /// </summary>
        /// <param name="methodName">Name of the default method for this opcode.</param>
        public AlternateAttribute(string methodName)
        {
            this.methodName = methodName;
        }
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets the name of the default method for this opcode.
        /// </summary>
        public string MethodName
        {
            get { return methodName; }
        }
        /// <summary>
        /// Gets or sets the operand sizes that the method accepts.
        /// </summary>
        public int OperandSize
        {
            get { return operandSize; }
            set { operandSize = value; }
        }
        /// <summary>
        /// Gets or sets the address sizes that the method accepts.
        /// </summary>
        public int AddressSize
        {
            get { return addressSize; }
            set { addressSize = value; }
        }
        #endregion

        #region Private Fields
        private string methodName;
        private int operandSize = 32;
        private int addressSize = 16;
        #endregion
    }
}
